#include<iostream>
using namespace std;
class Solution {
public:
    int lengthOfLongestSubstring(string s) {
        int f=0, ans=0;
        int l[200];
        for (int i = 0; i < 200; i++)l[i] = -1;
        for (int i = 0; i < s.length(); i++)
        {
            char c = s[i];
            if (l[c]+1> f)f = l[c]+1;
            if (i - f > ans)ans = i - f;
            l[c] = i;
        }
        return ans + 1;

    }
};

int main()
{
    string ss ;
    Solution s;
    while(cin>>ss) cout << s.lengthOfLongestSubstring(ss) << endl;
}